<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDBusConnection Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDBusConnection Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusConnection class represents a connection to the D-Bus
bus daemon. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qdbusconnection.html#BusType-enum">BusType</a></b> { SessionBus, SystemBus, ActivationBus }</li><li><div class="fn" />enum <b><a href="qdbusconnection.html#RegisterOption-enum">RegisterOption</a></b> { ExportAdaptors, ExportScriptableSlots, ExportScriptableSignals, ExportScriptableProperties, ..., ExportChildObjects }</li><li><div class="fn" />class <b><a href="qdbusconnection-registeroptions.html">RegisterOptions</a></b></li><li><div class="fn" />enum <b><a href="qdbusconnection.html#UnregisterMode-enum">UnregisterMode</a></b> { UnregisterNode, UnregisterTree }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbusconnection.html#QDBusConnection">__init__</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" /><b><a href="qdbusconnection.html#QDBusConnection-2">__init__</a></b> (<i>self</i>, QDBusConnection&#160;<i>other</i>)</li><li><div class="fn" />QDBusPendingCall <b><a href="qdbusconnection.html#asyncCall">asyncCall</a></b> (<i>self</i>, QDBusMessage&#160;<i>message</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</li><li><div class="fn" />QString <b><a href="qdbusconnection.html#baseService">baseService</a></b> (<i>self</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusconnection.html#call">call</a></b> (<i>self</i>, QDBusMessage&#160;<i>message</i>, QDBus.CallMode&#160;<i>mode</i>&#160;=&#160;QDBus.Block, int&#160;<i>timeout</i>&#160;=&#160;-1)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#callWithCallback">callWithCallback</a></b> (<i>self</i>, QDBusMessage&#160;<i>message</i>, QObject&#160;<i>receiver</i>, SLOT()&#160;<i>returnMethod</i>, SLOT()&#160;<i>errorMethod</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</li><li><div class="fn" />object <b><a href="qdbusconnection.html#callWithCallback-2">callWithCallback</a></b> (<i>self</i>, QDBusMessage&#160;<i>message</i>, callable&#160;<i>returnMethod</i>, callable&#160;<i>errorMethod</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#callWithCallback-3">callWithCallback</a></b> (<i>self</i>, QDBusMessage&#160;<i>message</i>, QObject&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</li><li><div class="fn" />object <b><a href="qdbusconnection.html#callWithCallback-4">callWithCallback</a></b> (<i>self</i>, QDBusMessage&#160;<i>message</i>, callable&#160;<i>slot</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#connect">connect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QObject&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</li><li><div class="fn" />object <b><a href="qdbusconnection.html#connect-2">connect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, callable&#160;<i>slot</i>)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#connect-3">connect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QString&#160;<i>signature</i>, QObject&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</li><li><div class="fn" />object <b><a href="qdbusconnection.html#connect-4">connect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QString&#160;<i>signature</i>, callable&#160;<i>slot</i>)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#connect-5">connect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QStringList&#160;<i>argumentMatch</i>, QString&#160;<i>signature</i>, QObject&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</li><li><div class="fn" />object <b><a href="qdbusconnection.html#connect-6">connect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QStringList&#160;<i>argumentMatch</i>, QString&#160;<i>signature</i>, callable&#160;<i>slot</i>)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#disconnect">disconnect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QObject&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</li><li><div class="fn" />object <b><a href="qdbusconnection.html#disconnect-2">disconnect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, callable&#160;<i>slot</i>)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#disconnect-3">disconnect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QString&#160;<i>signature</i>, QObject&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</li><li><div class="fn" />object <b><a href="qdbusconnection.html#disconnect-4">disconnect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QString&#160;<i>signature</i>, callable&#160;<i>slot</i>)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#disconnect-5">disconnect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QStringList&#160;<i>argumentMatch</i>, QString&#160;<i>signature</i>, QObject&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</li><li><div class="fn" />object <b><a href="qdbusconnection.html#disconnect-6">disconnect</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QStringList&#160;<i>argumentMatch</i>, QString&#160;<i>signature</i>, callable&#160;<i>slot</i>)</li><li><div class="fn" />QDBusConnectionInterface <b><a href="qdbusconnection.html#interface">interface</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#isConnected">isConnected</a></b> (<i>self</i>)</li><li><div class="fn" />QDBusError <b><a href="qdbusconnection.html#lastError">lastError</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdbusconnection.html#name">name</a></b> (<i>self</i>)</li><li><div class="fn" />QObject <b><a href="qdbusconnection.html#objectRegisteredAt">objectRegisteredAt</a></b> (<i>self</i>, QString&#160;<i>path</i>)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#registerObject">registerObject</a></b> (<i>self</i>, QString&#160;<i>path</i>, QObject&#160;<i>object</i>, RegisterOptions&#160;<i>options</i>&#160;=&#160;QDBusConnection.ExportAdaptors)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#registerService">registerService</a></b> (<i>self</i>, QString&#160;<i>serviceName</i>)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#send">send</a></b> (<i>self</i>, QDBusMessage&#160;<i>message</i>)</li><li><div class="fn" /><b><a href="qdbusconnection.html#unregisterObject">unregisterObject</a></b> (<i>self</i>, QString&#160;<i>path</i>, UnregisterMode&#160;<i>mode</i>&#160;=&#160;QDBusConnection.UnregisterNode)</li><li><div class="fn" />bool <b><a href="qdbusconnection.html#unregisterService">unregisterService</a></b> (<i>self</i>, QString&#160;<i>serviceName</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QDBusConnection <b><a href="qdbusconnection.html#connectToBus">connectToBus</a></b> (BusType&#160;<i>type</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />QDBusConnection <b><a href="qdbusconnection.html#connectToBus-2">connectToBus</a></b> (QString&#160;<i>address</i>, QString&#160;<i>name</i>)</li><li><div class="fn" /><b><a href="qdbusconnection.html#disconnectFromBus">disconnectFromBus</a></b> (QString&#160;<i>name</i>)</li><li><div class="fn" />QDBusConnection <b><a href="qdbusconnection.html#sender">sender</a></b> ()</li><li><div class="fn" />QDBusConnection <b><a href="qdbusconnection.html#sessionBus">sessionBus</a></b> ()</li><li><div class="fn" />QDBusConnection <b><a href="qdbusconnection.html#systemBus">systemBus</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusConnection class represents a connection to the D-Bus
bus daemon.</p>
<p>This class is the initial point in a D-Bus session. Using it,
you can get access to remote objects, interfaces; connect remote
signals to your object's slots; register objects, etc.</p>
<p>D-Bus connections are created using the <a href="qdbusconnection.html#connectToBus">connectToBus</a>() function,
which opens a connection to the server daemon and does the initial
handshaking, associating that connection with a name. Further
attempts to connect using the same name will return the same
connection.</p>
<p>The connection is then torn down using the <a href="qdbusconnection.html#disconnectFromBus">disconnectFromBus</a>()
function.</p>
<p>Once disconnected, calling <a href="qdbusconnection.html#connectToBus">connectToBus</a>() will not
reestablish a connection, you must create a new QDBusConnection
instance.</p>
<p>As a convenience for the two most common connection types, the
<a href="qdbusconnection.html#sessionBus">sessionBus</a>() and
<a href="qdbusconnection.html#systemBus">systemBus</a>() functions
return open connections to the session server daemon and the system
server daemon, respectively. Those connections are opened when
first used and are closed when the <a href="qcoreapplication.html">QCoreApplication</a> destructor is run.</p>
<p>D-Bus also supports peer-to-peer connections, without the need
for a bus server daemon. Using this facility, two applications can
talk to each other and exchange messages. This can be achieved by
passing an address to <a href="qdbusconnection.html#connectToBus">connectToBus</a>() function,
which was opened by another D-Bus application using
QDBusServer.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="BusType-enum" />QDBusConnection.BusType</h3><p>Specifies the type of the bus connection. The valid bus types
are:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QDBusConnection.SessionBus</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">the session bus, associated with the running
desktop session</td>
</tr>
<tr>
<td class="topAlign"><tt>QDBusConnection.SystemBus</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">the system bus, used to communicate with
system-wide processes</td>
</tr>
<tr>
<td class="topAlign"><tt>QDBusConnection.ActivationBus</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">the activation bus, the "alias" for the bus
that started the service</td>
</tr>
</table>
<p>On the Session Bus, one can find other applications by the same
user that are sharing the same desktop session (hence the name). On
the System Bus, however, processes shared for the whole system are
usually found.</p>


<h3 class="fn"><a name="RegisterOption-enum" />QDBusConnection.RegisterOption</h3><p>Specifies the options for registering objects with the
connection. The possible values are:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QDBusConnection.ExportAdaptors</tt></td>
<td class="topAlign"><tt>0x01</tt></td>
<td class="topAlign">export the contents of adaptors found in this
object</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportScriptableSlots</tt></td>
<td class="topAlign"><tt>0x10</tt></td>
<td class="topAlign">export this object's scriptable slots</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportScriptableSignals</tt></td>
<td class="topAlign"><tt>0x20</tt></td>
<td class="topAlign">export this object's scriptable signals</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportScriptableProperties</tt></td>
<td class="topAlign"><tt>0x40</tt></td>
<td class="topAlign">export this object's scriptable
properties</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportScriptableInvokables</tt></td>
<td class="topAlign"><tt>0x80</tt></td>
<td class="topAlign">export this object's scriptable
invokables</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportScriptableContents</tt></td>
<td class="topAlign"><tt>0xf0</tt></td>
<td class="topAlign">shorthand form for ExportScriptableSlots |
ExportScriptableSignals | ExportScriptableProperties</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportNonScriptableSlots</tt></td>
<td class="topAlign"><tt>0x100</tt></td>
<td class="topAlign">export this object's non-scriptable slots</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportNonScriptableSignals</tt></td>
<td class="topAlign"><tt>0x200</tt></td>
<td class="topAlign">export this object's non-scriptable
signals</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportNonScriptableProperties</tt></td>
<td class="topAlign"><tt>0x400</tt></td>
<td class="topAlign">export this object's non-scriptable
properties</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportNonScriptableInvokables</tt></td>
<td class="topAlign"><tt>0x800</tt></td>
<td class="topAlign">export this object's non-scriptable
invokables</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportNonScriptableContents</tt></td>
<td class="topAlign"><tt>0xf00</tt></td>
<td class="topAlign">shorthand form for ExportNonScriptableSlots |
ExportNonScriptableSignals | ExportNonScriptableProperties</td>
</tr>
<tr>
<td class="topAlign"><tt>QDBusConnection.ExportAllSlots</tt></td>
<td class="topAlign"><tt>ExportScriptableSlots |
ExportNonScriptableSlots</tt></td>
<td class="topAlign">export all of this object's slots</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportAllSignals</tt></td>
<td class="topAlign"><tt>ExportScriptableSignals |
ExportNonScriptableSignals</tt></td>
<td class="topAlign">export all of this object's signals</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportAllProperties</tt></td>
<td class="topAlign"><tt>ExportScriptableProperties |
ExportNonScriptableProperties</tt></td>
<td class="topAlign">export all of this object's properties</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportAllInvokables</tt></td>
<td class="topAlign"><tt>ExportScriptableInvokables |
ExportNonScriptableInvokables</tt></td>
<td class="topAlign">export all of this object's invokables</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportAllContents</tt></td>
<td class="topAlign"><tt>ExportScriptableContents |
ExportNonScriptableContents</tt></td>
<td class="topAlign">export all of this object's contents</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnection.ExportChildObjects</tt></td>
<td class="topAlign"><tt>0x1000</tt></td>
<td class="topAlign">export this object's child objects</td>
</tr>
</table>
<p>The RegisterOptions type is a typedef for <a href="qflags.html">QFlags</a>&lt;RegisterOption&gt;. It stores an OR
combination of RegisterOption values.</p>
<p><b>See also</b> <a href="qdbusconnection.html#registerObject">registerObject</a>(),
<a href="qdbusabstractadaptor.html">QDBusAbstractAdaptor</a>, and
<a href="usingadaptors.html">Using adaptors</a>.</p>


<h3 class="fn"><a name="UnregisterMode-enum" />QDBusConnection.UnregisterMode</h3><p>The mode for unregistering an object path:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QDBusConnection.UnregisterNode</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">unregister this node only: do not unregister
child objects</td>
</tr>
<tr>
<td class="topAlign"><tt>QDBusConnection.UnregisterTree</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">unregister this node and all its sub-tree</td>
</tr>
</table>
<p>Note, however, if this object was registered with the <a href="qdbusconnection.html#RegisterOption-enum">ExportChildObjects</a>
option, UnregisterNode will unregister the child objects too.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDBusConnection" />QDBusConnection.__init__ (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Creates a <a href="qdbusconnection.html">QDBusConnection</a>
object attached to the connection with name <i>name</i>.</p>
<p>This does not open the connection. You have to call <a href="qdbusconnection.html#connectToBus">connectToBus</a>() to open
it.</p>


<h3 class="fn"><a name="QDBusConnection-2" />QDBusConnection.__init__ (<i>self</i>, <a href="qdbusconnection.html">QDBusConnection</a>&#160;<i>other</i>)</h3><p>Creates a copy of the <i>other</i> connection.</p>


<h3 class="fn"><a name="asyncCall" /><a href="qdbuspendingcall.html">QDBusPendingCall</a> QDBusConnection.asyncCall (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a>&#160;<i>message</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</h3><p>Sends the <i>message</i> over this connection and returns
immediately. This function is suitable for method calls only. It
returns an object of type <a href="qdbuspendingcall.html">QDBusPendingCall</a> which can be used to
track the status of the reply.</p>
<p>If no reply is received within <i>timeout</i> milliseconds, an
automatic error will be delivered indicating the expiration of the
call. The default <i>timeout</i> is -1, which will be replaced with
an implementation-defined value that is suitable for inter-process
communications (generally, 25 seconds). This timeout is also the
upper limit for waiting in QDBusPendingCall.waitForFinished().</p>
<p>See the <a href="qdbusabstractinterface.html#asyncCall">QDBusInterface.asyncCall</a>()
function for a more friendly way of placing calls.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="baseService" />QString QDBusConnection.baseService (<i>self</i>)</h3><p>Returns the unique connection name for this connection, if this
<a href="qdbusconnection.html">QDBusConnection</a> object is
connected, or an empty <a href="qstring.html">QString</a>
otherwise.</p>
<p>A Unique Connection Name is a string in the form ":x.xxx" (where
x are decimal digits) that is assigned by the D-Bus server daemon
upon connection. It uniquely identifies this client in the bus.</p>
<p>This function returns an empty <a href="qstring.html">QString</a> for peer-to-peer connections.</p>


<h3 class="fn"><a name="call" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusConnection.call (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a>&#160;<i>message</i>, <a href="qdbus.html#CallMode-enum">QDBus.CallMode</a>&#160;<i>mode</i>&#160;=&#160;QDBus.Block, int&#160;<i>timeout</i>&#160;=&#160;-1)</h3><p>Sends the <i>message</i> over this connection and blocks,
waiting for a reply, for at most <i>timeout</i> milliseconds. This
function is suitable for method calls only. It returns the reply
message as its return value, which will be either of type <a href="qdbusmessage.html#MessageType-enum">QDBusMessage.ReplyMessage</a>
or <a href="qdbusmessage.html#MessageType-enum">QDBusMessage.ErrorMessage</a>.</p>
<p>If no reply is received within <i>timeout</i> milliseconds, an
automatic error will be delivered indicating the expiration of the
call. The default <i>timeout</i> is -1, which will be replaced with
an implementation-defined value that is suitable for inter-process
communications (generally, 25 seconds).</p>
<p>See the <a href="qdbusabstractinterface.html#call">QDBusInterface.call</a>()
function for a more friendly way of placing calls.</p>
<p><b>Warning:</b> If <i>mode</i> is <a href="qdbus.html#CallMode-enum">QDBus.BlockWithGui</a>, this function
will reenter the Qt event loop in order to wait for the reply.
During the wait, it may deliver signals and other method calls to
your application. Therefore, it must be prepared to handle a
reentrancy whenever a call is placed with call().</p>


<h3 class="fn"><a name="callWithCallback" />bool QDBusConnection.callWithCallback (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a>&#160;<i>message</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()&#160;<i>returnMethod</i>, SLOT()&#160;<i>errorMethod</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</h3><p>Sends the <i>message</i> over this connection and returns
immediately. When the reply is received, the method
<i>returnMethod</i> is called in the <i>receiver</i> object. If an
error occurs, the method <i>errorMethod</i> will be called
instead.</p>
<p>If no reply is received within <i>timeout</i> milliseconds, an
automatic error will be delivered indicating the expiration of the
call. The default <i>timeout</i> is -1, which will be replaced with
an implementation-defined value that is suitable for inter-process
communications (generally, 25 seconds).</p>
<p>This function is suitable for method calls only. It is
guaranteed that the slot will be called exactly once with the
reply, as long as the parameter types match and no error
occurs.</p>
<p>Returns true if the message was sent, or false if the message
could not be sent.</p>


<h3 class="fn"><a name="callWithCallback-2" />object QDBusConnection.callWithCallback (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a>&#160;<i>message</i>, callable&#160;<i>returnMethod</i>, callable&#160;<i>errorMethod</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</h3><p>This function is deprecated.</p>
<p>This is an overloaded function.</p>
<p>Sends the <i>message</i> over this connection and returns
immediately. When the reply is received, the method
<i>returnMethod</i> is called in the <i>receiver</i> object.</p>
<p>This function is suitable for method calls only. It is
guaranteed that the slot will be called exactly once with the
reply, as long as the parameter types match and no error
occurs.</p>
<p>This function is dangerous because it cannot report errors,
including the expiration of the timeout.</p>
<p>Returns true if the message was sent, or false if the message
could not be sent.</p>


<h3 class="fn"><a name="callWithCallback-3" />bool QDBusConnection.callWithCallback (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a>&#160;<i>message</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</h3><h3 class="fn"><a name="callWithCallback-4" />object QDBusConnection.callWithCallback (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a>&#160;<i>message</i>, callable&#160;<i>slot</i>, int&#160;<i>timeout</i>&#160;=&#160;-1)</h3><h3 class="fn"><a name="connect" />bool QDBusConnection.connect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</h3><p>Connects the signal specified by the <i>service</i>,
<i>path</i>, <i>interface</i> and <i>name</i> parameters to the
slot <i>slot</i> in object <i>receiver</i>. The arguments
<i>service</i> and <i>path</i> can be empty, denoting a connection
to any signal of the (<i>interface</i>, <i>name</i>) pair, from any
remote application.</p>
<p>Returns true if the connection was successful.</p>
<p><b>Warning:</b> The signal will only be delivered to the slot if
the parameters match. This verification can be done only when the
signal is received, not at connection time.</p>


<h3 class="fn"><a name="connect-2" />object QDBusConnection.connect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, callable&#160;<i>slot</i>)</h3><p>This is an overloaded function.</p>
<p>Connects the signal to the slot <i>slot</i> in object
<i>receiver</i>. Unlike the previous <a href="qdbusconnection.html#connect">connect</a>() overload, this
function allows one to specify the parameter signature to be
connected using the <i>signature</i> variable. The function will
then verify that this signature can be delivered to the slot
specified by <i>slot</i> and return false otherwise.</p>
<p>Returns true if the connection was successful.</p>
<p><b>Note:</b> This function verifies that the signal signature
matches the slot's parameters, but it does not verify that the
actual signal exists with the given signature in the remote
service.</p>


<h3 class="fn"><a name="connect-3" />bool QDBusConnection.connect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QString&#160;<i>signature</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</h3><p>This is an overloaded function.</p>
<p>Connects the signal to the slot <i>slot</i> in object
<i>receiver</i>. Unlike the previous <a href="qdbusconnection.html#connect">connect</a>() overload, this
function allows one to specify the parameter signature to be
connected using the <i>signature</i> variable. The function will
then verify that this signature can be delivered to the slot
specified by <i>slot</i> and return false otherwise.</p>
<p>The <i>argumentMatch</i> parameter lists the string parameters
to be matched, in sequential order. Note that, to match an empty
string, you need to pass a <a href="qstring.html">QString</a> that
is empty but not null (i.e., <a href="qstring.html">QString</a>("")). A null <a href="qstring.html">QString</a> skips matching at that position.</p>
<p>Returns true if the connection was successful.</p>
<p><b>Note:</b> This function verifies that the signal signature
matches the slot's parameters, but it does not verify that the
actual signal exists with the given signature in the remote
service.</p>
<p>This function was introduced in Qt 4.6.</p>


<h3 class="fn"><a name="connect-4" />object QDBusConnection.connect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QString&#160;<i>signature</i>, callable&#160;<i>slot</i>)</h3><h3 class="fn"><a name="connect-5" />bool QDBusConnection.connect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QStringList&#160;<i>argumentMatch</i>, QString&#160;<i>signature</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</h3><h3 class="fn"><a name="connect-6" />object QDBusConnection.connect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QStringList&#160;<i>argumentMatch</i>, QString&#160;<i>signature</i>, callable&#160;<i>slot</i>)</h3><h3 class="fn"><a name="connectToBus" /><a href="qdbusconnection.html">QDBusConnection</a> QDBusConnection.connectToBus (<a href="qdbusconnection.html#BusType-enum">BusType</a>&#160;<i>type</i>, QString&#160;<i>name</i>)</h3><p>Opens a connection of type <i>type</i> to one of the known
busses and associate with it the connection name <i>name</i>.
Returns a <a href="qdbusconnection.html">QDBusConnection</a> object
associated with that connection.</p>


<h3 class="fn"><a name="connectToBus-2" /><a href="qdbusconnection.html">QDBusConnection</a> QDBusConnection.connectToBus (QString&#160;<i>address</i>, QString&#160;<i>name</i>)</h3><p>Opens a connection to a private bus on address <i>address</i>
and associate with it the connection name <i>name</i>. Returns a
<a href="qdbusconnection.html">QDBusConnection</a> object
associated with that connection.</p>


<h3 class="fn"><a name="disconnect" />bool QDBusConnection.disconnect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</h3><p>Disconnects the signal specified by the <i>service</i>,
<i>path</i>, <i>interface</i> and <i>name</i> parameters from the
slot <i>slot</i> in object <i>receiver</i>. The arguments must be
the same as passed to the <a href="qdbusconnection.html#connect">connect</a>() function.</p>
<p>Returns true if the disconnection was successful.</p>


<h3 class="fn"><a name="disconnect-2" />object QDBusConnection.disconnect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, callable&#160;<i>slot</i>)</h3><p>This is an overloaded function.</p>
<p>Disconnects the signal specified by the <i>service</i>,
<i>path</i>, <i>interface</i>, <i>name</i>, and <i>signature</i>
parameters from the slot <i>slot</i> in object <i>receiver</i>. The
arguments must be the same as passed to the <a href="qdbusconnection.html#connect">connect</a>() function.</p>
<p>Returns true if the disconnection was successful.</p>


<h3 class="fn"><a name="disconnect-3" />bool QDBusConnection.disconnect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QString&#160;<i>signature</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</h3><p>This is an overloaded function.</p>
<p>Disconnects the signal specified by the <i>service</i>,
<i>path</i>, <i>interface</i>, <i>name</i>, <i>argumentMatch</i>,
and <i>signature</i> parameters from the slot <i>slot</i> in object
<i>receiver</i>. The arguments must be the same as passed to the
<a href="qdbusconnection.html#connect">connect</a>() function.</p>
<p>Returns true if the disconnection was successful.</p>
<p>This function was introduced in Qt 4.6.</p>


<h3 class="fn"><a name="disconnect-4" />object QDBusConnection.disconnect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QString&#160;<i>signature</i>, callable&#160;<i>slot</i>)</h3><h3 class="fn"><a name="disconnect-5" />bool QDBusConnection.disconnect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QStringList&#160;<i>argumentMatch</i>, QString&#160;<i>signature</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()&#160;<i>slot</i>)</h3><h3 class="fn"><a name="disconnect-6" />object QDBusConnection.disconnect (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>, QString&#160;<i>name</i>, QStringList&#160;<i>argumentMatch</i>, QString&#160;<i>signature</i>, callable&#160;<i>slot</i>)</h3><h3 class="fn"><a name="disconnectFromBus" />QDBusConnection.disconnectFromBus (QString&#160;<i>name</i>)</h3><p>Closes the bus connection of name <i>name</i>.</p>
<p>Note that if there are still <a href="qdbusconnection.html">QDBusConnection</a> objects associated with
the same connection, the connection will not be closed until all
references are dropped. However, no further references can be
created using the <a href="qdbusconnection.html">QDBusConnection</a> constructor.</p>


<h3 class="fn"><a name="interface" /><a href="qdbusconnectioninterface.html">QDBusConnectionInterface</a> QDBusConnection.interface (<i>self</i>)</h3><p>Returns a <a href="qdbusconnectioninterface.html">QDBusConnectionInterface</a> object
that represents the D-Bus server interface on this connection.</p>


<h3 class="fn"><a name="isConnected" />bool QDBusConnection.isConnected (<i>self</i>)</h3><p>Returns true if this <a href="qdbusconnection.html">QDBusConnection</a> object is connected.</p>


<h3 class="fn"><a name="lastError" /><a href="qdbuserror.html">QDBusError</a> QDBusConnection.lastError (<i>self</i>)</h3><p>Returns the last error that happened in this connection.</p>
<p>This function is provided for low-level code. If you're using
<a href="qdbusabstractinterface.html#call">QDBusInterface.call</a>(),
error codes are reported by its return value.</p>
<p><b>See also</b> <a href="qdbusinterface.html">QDBusInterface</a>
and <a href="qdbusmessage.html">QDBusMessage</a>.</p>


<h3 class="fn"><a name="name" />QString QDBusConnection.name (<i>self</i>)</h3><p>Returns the connection name for this connection, as given as the
name parameter to <a href="qdbusconnection.html#connectToBus">connectToBus</a>().</p>
<p>The connection name can be used to uniquely identify actual
underlying connections to buses. Copies made from a single
connection will always implicitly share the underlying connection,
and hence will have the same connection name.</p>
<p>Inversely, two connections having different connection names
will always either be connected to different buses, or have a
different unique name (as returned by <a href="qdbusconnection.html#baseService">baseService</a>()) on that
bus.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qdbusconnection.html#connectToBus">connectToBus</a>() and <a href="qdbusconnection.html#disconnectFromBus">disconnectFromBus</a>().</p>


<h3 class="fn"><a name="objectRegisteredAt" /><a href="qobject.html">QObject</a> QDBusConnection.objectRegisteredAt (<i>self</i>, QString&#160;<i>path</i>)</h3><p>Return the object that was registered with the <a href="qdbusconnection.html#registerObject">registerObject</a>() at the
object path given by <i>path</i>.</p>


<h3 class="fn"><a name="registerObject" />bool QDBusConnection.registerObject (<i>self</i>, QString&#160;<i>path</i>, <a href="qobject.html">QObject</a>&#160;<i>object</i>, <a href="qdbusconnection-registeroptions.html">RegisterOptions</a>&#160;<i>options</i>&#160;=&#160;QDBusConnection.ExportAdaptors)</h3><p>Registers the object <i>object</i> at path <i>path</i> and
returns true if the registration was successful. The <i>options</i>
parameter specifies how much of the object <i>object</i> will be
exposed through D-Bus.</p>
<p>This function does not replace existing objects: if there is
already an object registered at path <i>path</i>, this function
will return false. Use <a href="qdbusconnection.html#unregisterObject">unregisterObject</a>() to
unregister it first.</p>
<p>You cannot register an object as a child object of an object
that was registered with <a href="qdbusconnection.html#RegisterOption-enum">QDBusConnection.ExportChildObjects</a>.</p>


<h3 class="fn"><a name="registerService" />bool QDBusConnection.registerService (<i>self</i>, QString&#160;<i>serviceName</i>)</h3><p>Attempts to register the <i>serviceName</i> on the D-Bus server
and returns true if the registration succeeded. The registration
will fail if the name is already registered by another
application.</p>
<p><b>See also</b> <a href="qdbusconnection.html#unregisterService">unregisterService</a>()
and <a href="qdbusconnectioninterface.html#registerService">QDBusConnectionInterface.registerService</a>().</p>


<h3 class="fn"><a name="send" />bool QDBusConnection.send (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a>&#160;<i>message</i>)</h3><p>Sends the <i>message</i> over this connection, without waiting
for a reply. This is suitable for errors, signals, and return
values as well as calls whose return values are not necessary.</p>
<p>Returns true if the message was queued successfully, false
otherwise.</p>


<h3 class="fn"><a name="sender" /><a href="qdbusconnection.html">QDBusConnection</a> QDBusConnection.sender ()</h3><p>Returns the connection that sent the signal, if called in a slot
activated by <a href="qdbus.html">QDBus</a>; otherwise it returns
0.</p>
<p><b>Note:</b> Please avoid this function. This function is not
thread-safe, so if there's any other thread delivering a D-Bus
call, this function may return the wrong connection. In new code,
please use <a href="qdbuscontext.html#connection">QDBusContext.connection</a>() (see
that class for a description on how to use it).</p>
<p><b>Warning:</b> This function is not <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>


<h3 class="fn"><a name="sessionBus" /><a href="qdbusconnection.html">QDBusConnection</a> QDBusConnection.sessionBus ()</h3><p>Returns a <a href="qdbusconnection.html">QDBusConnection</a>
object opened with the session bus. The object reference returned
by this function is valid until the application terminates, at
which point the connection will be closed and the object
deleted.</p>


<h3 class="fn"><a name="systemBus" /><a href="qdbusconnection.html">QDBusConnection</a> QDBusConnection.systemBus ()</h3><p>Returns a <a href="qdbusconnection.html">QDBusConnection</a>
object opened with the system bus. The object reference returned by
this function is valid until the <a href="qcoreapplication.html">QCoreApplication</a>'s destructor is run,
when the connection will be closed and the object, deleted.</p>


<h3 class="fn"><a name="unregisterObject" />QDBusConnection.unregisterObject (<i>self</i>, QString&#160;<i>path</i>, <a href="qdbusconnection.html#UnregisterMode-enum">UnregisterMode</a>&#160;<i>mode</i>&#160;=&#160;QDBusConnection.UnregisterNode)</h3><p>Unregisters an object that was registered with the <a href="qdbusconnection.html#registerObject">registerObject</a>() at the
object path given by <i>path</i> and, if <i>mode</i> is <a href="qdbusconnection.html#UnregisterMode-enum">QDBusConnection.UnregisterTree</a>,
all of its sub-objects too.</p>
<p>Note that you cannot unregister objects that were not registered
with <a href="qdbusconnection.html#registerObject">registerObject</a>().</p>


<h3 class="fn"><a name="unregisterService" />bool QDBusConnection.unregisterService (<i>self</i>, QString&#160;<i>serviceName</i>)</h3><p>Unregisters the service <i>serviceName</i> that was previously
registered with <a href="qdbusconnection.html#registerService">registerService</a>() and
returns true if it succeeded.</p>
<p><b>See also</b> <a href="qdbusconnection.html#registerService">registerService</a>() and
<a href="qdbusconnectioninterface.html#unregisterService">QDBusConnectionInterface.unregisterService</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>